package com.pcrtool.calculateequipment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pcrtool.calculateequipment.entity.UnitData;
import com.pcrtool.calculateequipment.mapper.UnitDataMapper;
import com.pcrtool.calculateequipment.service.UnitDataService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yzs
 * @since 2021-12-30
 */
@Service
public class UnitDataServiceImpl extends ServiceImpl<UnitDataMapper, UnitData> implements UnitDataService {

    @Override
    public Page<UnitData> findPage(Long current, Long limit, UnitData unitData) {
        Page<UnitData> page = new Page<>(current,limit);

        QueryWrapper<UnitData> wrapper = new QueryWrapper<>();

        if (unitData.getUnitId() != null){
            wrapper.eq("unit_id",unitData.getUnitId());
        }

        Page<UnitData> unitDataPage  = (Page<UnitData>) baseMapper.selectPage(page,wrapper);

        return unitDataPage;

    }
}
